import React, {useEffect, useState} from 'react';
import store from "./store";
import {asyncGetGoodsList} from "./store/slices/goods";

function App(props) {
    const [goodsList,setGoodsList] = useState([]);
    useEffect(()=>{
        // 更新数据状态
        store.dispatch(asyncGetGoodsList()).then(value=>{
            console.log("value",value);
            setGoodsList(value.goods.goodsList)
        });
    },[])
    return (
        <div>
            {
                goodsList.map(item=>(
                    <p key={item.id}>{item.goodsName}</p>
                ))
            }
        </div>
    );
}

export default App;